package Io;

import java.io.*;

//*
//        *  基于IO流对文件对象进行读写的处理：
//        *          所有字符流的基类：Reader Writer
//        *          实现类：InputStreamReader OutputStreamWriter 字节流、字符流的转换处理流
//        */
public class Test11 {
    /**
     * 从控制台输入信息，保存至指定文件中
     * @param args
     */
    public static void main(String[] args) {

        BufferedWriter bw = null;

        BufferedReader br = null;
        try {
            //1.创建字符流
            br = new BufferedReader(new InputStreamReader(System.in));
            bw = new BufferedWriter
                    (new OutputStreamWriter(new FileOutputStream(new File("d:/aa/a/b/tt1.txt"))));

            String line = br.readLine();
            while (!line.equals("r")){
                bw.write(line);
                line = br.readLine();
            }
            bw.flush();
            bw.close();
            br.close();
        } catch (Exception e) {
            e.printStackTrace();

        }
    }
}
